home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 8: LINUX Games
/
Linux Cubed Series 8 - LINUX Games.iso
/
games
/
strategy
/
vga_card.000
/
vga_cardgames-1.3.1.tar
/
vga_cardgames
/
klondike.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-26
|
2KB
|
103 lines
/*
* Klondike
*
* Copyright (C) Evan Harris, 1991, 1994, 1995.
*
* Permission is granted to freely redistribute and modify this code,
* providing the author(s) get credit for having written it.
*/
#include "common.h"
#define FROMSTOCK -10
#define MOVEOFF -11
#define TOFOUNDATION -12
#define COLSPECBASE -20
#define IMPOSSIBLE 0
#define POSSIBLE 1
#define DESIRABLE 2
#define POSN(col, row) ((col) * 100 + (row))
#define ROW(pos) ((pos) % 100)
#define COL(pos) ((pos) / 100)
#define NOPOSN -1
#define SPADES 0
#define CLUBS 1
#define HEARTS 2
#define DIAMONDS 3
#define NUMSUITS 4
#define CARD(suit, type) ((suit) * 13 + (type))
#define NOCARD 255
#define SUIT(card) ((card) / 13)
#define TYPE(card) ((card) % 13)
#define ISCARD(card) ((card) >= 0 && (card) < 52)
#define ISBLACK(card) (SUIT(card) == SPADES || SUIT(card) == CLUBS)
#define ISRED(card) (SUIT(card) == HEARTS || SUIT(card) == DIAMONDS)
#define NUMCARDS 52
#define COLUMNS 7
#define STOCK (COLUMNS)
#define PILE (STOCK + 1)
#define FOUNDATION (PILE + 1)
#define TOHINT(col) (((col) + 1) << 7)
#define NOHINT(cmd) ((cmd) & 0x7f)
#define HINT(hint) (((hint) >> 7) - 1)
#define HASHINT(cmd) ((cmd) & ~0x7f)
#define ISCOLSPEC(spec) ((spec) <= COLSPECBASE)
#define COLTOSPEC(col) (COLSPECBASE - (col))
#define SPECTOCOL(spec) (COLSPECBASE - (spec))
#define ACE 0
#define TWO 1
#define THREE 2
#define FOUR 3
#define FIVE 4
#define SIX 5
#define SEVEN 6
#define EIGHT 7
#define NINE 8
#define TEN 9
#define JACK 10
#define QUEEN 11
#define KING 12
extern unsigned char column[COLUMNS]; /* First card of column */
extern unsigned char stock, pile; /* First card of stock, pile */
extern short cards[NUMCARDS]; /* Positions of cards */
extern unsigned char next[NUMCARDS]; /* Card underneath */
extern unsigned char hidden[NUMCARDS]; /* Cards which are face down */
extern unsigned char foundation[NUMSUITS];
void main(int, char **);
void exit(int);
void InitDisplay(int, char **);
void DisplayColumn(short);
void DisplayFoundations(void);
void DisplayStockPile(void);
void Deal(void);
short GetCmd(void);
short FindDest(short);
short FindHintedDest(short, short);
void MakeMove(unsigned char, short);
void FromStock(int, int);
void MoveOff(unsigned char);
short CanMoveOff(unsigned char);
unsigned char LowestFoundation(unsigned char);